//
//  LoginHeader.h
//  MPWeChatDemo
//
//  Created by HappyMilk 01 on 2017/5/1.
//  Copyright © 2017年 srulos. All rights reserved.
//

#ifndef LoginHeader_h
#define LoginHeader_h

#import "LibHeader.h"
#import "QRCodeLoginViewController.h"
#import "LeanCloudLoginViewController.h"
#import "LeanCloudLoginViewController.h"
#import "MPWeChat.h"
#import "MBProgressHUD.h"
#import <AVOSCloud/AVOSCloud.h>
#import "MyAdTools.h"

#define LOC_STR(str)  NSLocalizedStringFromTable(str, @"Login", nil)
//中文
#define IS_CHINESE [[[NSLocale preferredLanguages] objectAtIndex:0] containsString:@"zh-Han"]

//hud
#define SHOW_HUD(_text)\
MBProgressHUD * progressHUD = [[MBProgressHUD alloc] initWithView:self.view];\
progressHUD.labelText = _text;\
[self.view addSubview:progressHUD];\
[self.view bringSubviewToFront:progressHUD];\
[progressHUD show:YES];\
[progressHUD hide:YES afterDelay:20];

#define SHOW_HUD_MESSAGE(title)\
MBProgressHUD * hud = [MBProgressHUD showHUDAddedTo:self.view animated:YES];\
hud.mode = MBProgressHUDModeText;\
CGFloat animationTime = title.length / 12.0f;\
if (animationTime < 1.0) {\
animationTime = 1.5;\
}\
[hud hide:YES afterDelay:animationTime];\
if(title.length > 15){\
[hud setDetailsLabelText:title];\
}\
else{\
[hud setLabelText:title];\
}

#define HIDE_HUD [MBProgressHUD hideHUDForView:self.view animated:YES];

#define SHOW_LOGIN_VIEW_CONTROLLER(_color)\
if([MPWeChat stander].m_isLogin == false){\
LeanCloudLoginViewController * leanCloudViewController = [[LeanCloudLoginViewController alloc]initWithNibName:@"LeanCloudLoginViewController" bundle:nil];\
leanCloudViewController.mainColor = [UIColor lightGrayColor];\
UINavigationController * navigationController = [[UINavigationController alloc]initWithRootViewController:leanCloudViewController];\
[self presentViewController:navigationController animated:YES completion:nil];\
return;\
}\



#endif /* LoginHeader_h */
